<?php
/**
 * @fileoverview    喜欢我的页面
 * @author          xinhua
 * @date            Feb  02 11:31:49 CST 2012
 * @copyright       sina meila
 */
include_once ('../../__global.php');
class likeme extends ml_controller{

    private $_page=1;                                    //默认第1页
    private $_begin=0;
    private $_uid;
    private $total;
    private $feedData=array();
    private $finnal=array();
    private $Acontent=array();
    private $nickname;
    private $uids=array();                              //用来获取nick


    //    public function init()
    //    {
    //        $this->set_access(self::ACCESS_SELF , self::NOACCESS_REDIRECT );
    //    }
    public function initParam()    {

        $tmp=$this->input('page','G');
        $this->_page = empty($tmp)?$this->_page:$tmp;//页
        $this->_begin =($this->_page-1)*120;
        $this->_uid = intval($this->input('uid','G'));//获取被查看人的uid
        $this->_uid = empty($this->_uid)?$this->__visitor['uid']:$this->_uid;
        $this->__owner['uid']=$this->_uid;
    }

    public function checkParam() {
        if(empty($this->_uid)){
            $this->redirect('/page/login.php');
        }
        if($this->_uid==$this->__visitor['uid']){
            $this->__isself=true;
        }else{
            $this->__isself=false;
        }
    }


    public function main(){

        ml_tool_actionlog::add_other_action($this->__visitor['uid'] , ML_SINAACTCODE_VIEW_HOME_LIKEME);
        
        
        $oRds = new ml_model_rdsNotice();
        $aRs = $oRds->getNotice($this->__visitor['uid']);
        if($this->_page == 1)
        {
            $oRds->clean_one_field($this->__visitor['uid'] , ml_model_rdsNotice::NTCTYPE_ADDATTITUDE );
        }
        $cnt['comment']=intval($aRs[ml_model_rdsNotice::NTCTYPE_ADDCOMMENT  ]);
        $cnt['atme']=intval($aRs[ml_model_rdsNotice::NTCTYPE_ADDATME  ]);
        $cnt['atti']=intval($aRs[ml_model_rdsNotice::NTCTYPE_ADDATTITUDE  ]);
        
        
        $model=new ml_model_dbLikeMe();

        $data=$model->attitudeMe($this->_uid,$this->_begin,ML_FEED_PAGESIZE);//第一个数据页数，第二个offset，第三个参数数据类型

        //$this->datafactory($data);
        $this->total=$model->countAttMe($this->_uid);
         
        $htmlModel=new ml_biz_feed_likeMe();

        $this->Acontent=$htmlModel->output($data, $this->_uid);

        $last=$this->total['num']-($this->_page-1)*120<ML_FEED_PAGESIZE?true:false;


        $this->set_scope_var('$totalPage', floor($this->total['num']/120)+1);//总页数
        $this->set_scope_var('$currentPage', intval($this->_page));//当前页
        $this->set_scope_var('$segment', 1);
        $this->set_scope_var('$lastSegment', $last);

        $obizUser = ml_biz_user_getinfo::get_instance();
        $obizUser->initUser($this->_uid,$this->__visitor['uid']);
        $userData=$obizUser->getUserArea();
        
        $this->set_scope_var('$skilltags',$userData['skill_tags']);
        $this->finnal['content']=$this->Acontent;
        $this->finnal['owner_uid']=$this->_uid;
        $this->finnal=array_merge($this->finnal,$userData);
        $this->finnal['cnt'] =$cnt;
        $this->set_page_id("likeMe");//谁给我改成大写的了。。。
        $this->page_output('user::likeMe', $this->finnal);

    }


}
new likeme();
?>